import 'dart:convert';

import 'package:ichinesereader/models/knowledgeword/knowledgeWord.dart';

KnowledgeWordsSearchResult knowledgeWordsSearchResultFromJson(String str) => KnowledgeWordsSearchResult.fromJson(json.decode(str));

String knowledgeWordsSearchResultToJson(KnowledgeWordsSearchResult data) => json.encode(data.toJson());

class KnowledgeWordsSearchResult {
    KnowledgeWordsSearchResult({
        this.status,
        this.message,
        this.result,
    });

    int? status;
    String? message;
    SearchResult? result;

    factory KnowledgeWordsSearchResult.fromJson(Map<String, dynamic> json) => KnowledgeWordsSearchResult(
        status: json["status"],
        message: json["message"],
        result: SearchResult.fromJson(json["result"]),
    );

    Map<String, dynamic> toJson() => {
        "status": status,
        "message": message,
        "result": result?.toJson(),
    };
}

class SearchResult {
    SearchResult({
        this.list,
    });

    List<KnowledgeWord>? list;

    factory SearchResult.fromJson(Map<String, dynamic> json) => SearchResult(
        list: List<KnowledgeWord>.from(json["list"].map((x) => KnowledgeWord.fromJson(x))),
    );

    Map<String, dynamic> toJson() => {
        "list": List<KnowledgeWord>.from(list!.map((x) => x.toJson())),
    };
}